package com.hw.utils;

import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Component;

/**
 * 获取当前账户名称
 *
 * @author Xg
 * @date 2021/7/5 20:11
 */
@Component
public class AdminUtils {

    /**
     * 获取当前账户名称
     *
     * @return
     */
    public static String getUserName() {
        String sysUser = (String) SecurityUtils.getSubject().getPrincipal();
        return JwtUtils.getClaim(sysUser, "username");
    }
}
